<?php
session_start();
require_once("koneksi.php");
$cekkunjungan = mysql_query("SELECT * FROM kunjungan WHERE tgl_kunjungan = curdate()");
$jumlah = mysql_num_rows($cekkunjungan);
 if(!isset($_SESSION['kunjungan'])) 
 {
        if($jumlah == 0)
        {
            $simpankunjungan = mysql_query("INSERT INTO kunjungan(tgl_kunjungan, banyak_kunjungan) VALUES (curdate(), '1')");
        }
        else
        {
            $updatekunjungan = mysql_query("UPDATE kunjungan SET banyak_kunjungan = (banyak_kunjungan + '1') WHERE tgl_kunjungan = curdate()"); 
        }
        $_SESSION['kunjungan'] = time();

 }

else if ($_SESSION['kunjungan'] == 'A')
{
    $_SESSION['kunjungan'] = 'B';
}

else if ($_SESSION['kunjungan'] == 'B')
{
    $_SESSION['kunjungan'] = 'A';
}

else if (time() - $_SESSION['kunjungan'] > 1800)
{
        if($jumlah == 0)
        {
            $simpankunjungan = mysql_query("INSERT INTO kunjungan(tgl_kunjungan, banyak_kunjungan) VALUES (curdate(), '1')");
        }
        else
        {
            $updatekunjungan = mysql_query("UPDATE kunjungan SET banyak_kunjungan = (banyak_kunjungan + '1') WHERE tgl_kunjungan = curdate()"); 
        }
        session_unset();     // unset $_SESSION variable for the run-time 
        session_destroy();   // destroy session data in storage
        $_SESSION['kunjungan'] = time();
}


?>

<!DOCTYPE html>
<!--[if lt IE 7]><html class="lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]><html class="lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html> <!--<![endif]-->
<head>
    <meta charset="utf-8">

    <title>Cari Kontrakan</title>
    <link rel="shortcut icon" href="images/favicon.png" />
    <!-- Define a viewport to mobile devices to use - telling the browser to assume that the page is as wide as the device (width=device-width) and setting the initial page zoom level to be 1 (initial-scale=1.0) -->
    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <!-- Google Web Font -->
    <link href='http://fonts.googleapis.com/css?family=Roboto' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Lato:300,400,700' rel='stylesheet' type='text/css'>

    <link href="css/styles.min.css" rel="stylesheet" type='text/css' media="all" />
    <link href='assets/demo/variations/default.css' rel='stylesheet' type='text/css' media='all' id='styleswitcher' /> 
    
        <link href='assets/demo/variations/default.css' rel='stylesheet' type='text/css' media='all' id='headerswitcher' /> 
        <link rel='stylesheet' type='text/css' href='plugins/form-daterangepicker/daterangepicker-bs3.css' /> 
        <link rel='stylesheet' type='text/css' href='plugins/fullcalendar/fullcalendar.css' /> 
        <link rel='stylesheet' type='text/css' href='plugins/form-markdown/css/bootstrap-markdown.min.css' /> 
        <link rel='stylesheet' type='text/css' href='plugins/codeprettifier/prettify.css' /> 
        <link rel='stylesheet' type='text/css' href='plugins/form-toggle/toggles.css' /> 

    <link href="css/style.css" rel="stylesheet" media="all">
    <!-- Include the bootstrap stylesheet -->
    <link href="css/bootstrap.css" rel="stylesheet" media="all">

    <!-- Include the Bootstrap responsive utitlities stylesheet -->
    <link href="css/_responsive-utilities.css" rel="stylesheet" media="all">


    <!-- Include the Awesome Font stylesheet -->
    <link href="css/font-awesome.min.css" rel="stylesheet" media="all">

    <!-- Include the bootstrap responsive stylesheet -->
    <link href="css/responsive.css" rel="stylesheet" media="all">

    <!-- Flexslider stylesheet -->
    <link href="js/flexslider/flexslider.css" rel="stylesheet" media="all">

    <!-- Pretty Photo stylesheet -->
    <link href="js/prettyphoto/prettyPhoto.css" rel="stylesheet" media="all">

    <!-- Pretty Photo stylesheet -->
    <link href="js/swipebox/swipebox.css" rel="stylesheet" media="all">

    <!-- Include the site main stylesheet -->
    <link href="css/main.css" rel="stylesheet" media="all">

    <!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
    <!--[if lt IE 9]>
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
    <![endif]-->
    <script src='jquery.js'></script>
        <script>
           jQuery(document).ready(function(){
                jQuery("#propinsi").change(function(){
                    var getValue= jQuery(this).val();
                    if(getValue == 0)
                    {
                        jQuery("#kota").html("<option>Pilih Provinsi Dulu</option>");
                    }
                    else
                    {
                        jQuery.getJSON('getdata.php',{'propinsi_id' : getValue},function(data){
                            var showData;
                            jQuery.each(data,function(index,value){
                                showData += "<option>"+value.kota_kabupaten+"</option>";
                            })
                            jQuery("#kota").html(showData)
                        })
                    }
                })
            })
    </script>

    <script>
           jQuery(document).ready(function(){
                jQuery("#propinsi_search").change(function(){
                    var getValue= jQuery(this).val();
                    if(getValue == 0)
                    {
                        jQuery("#kota_search").html("<option>Pilih Provinsi Dulu</option>");
                    }
                    else
                    {
                        jQuery.getJSON('getdata.php',{'propinsi_id' : getValue},function(data){
                            var showData;
                            jQuery.each(data,function(index,value){
                                showData += "<option>"+value.kota_kabupaten+"</option>";
                            })
                            jQuery("#kota_search").html(showData)
                        })
                    }
                })
            })
    </script>
   
</head>
<body>


<!-- Start Header -->
<div class="header-wrapper">

    <div class="container" ><!-- Start Header Container -->

        <header id="header" class="clearfix" style="margin-top:0px;">

            <div id="header-top" class="clearfix">
                <?php 
                            if(!isset($_SESSION['email'])) 
                            {include "belumlogin.html"; }
                            else 
                            { $email = $_SESSION['email'];
                            $query = mysql_query("SELECT * FROM anggota WHERE email = '$email'");
                            $hasil = mysql_fetch_array($query);
                            include "profile.php";}
                ?>

            </div>


            <!-- Logo -->
            <div id="logo">

                <a title="Cari Kost" href="index.php?page=home">
                    <img src="images/logo.png" alt="Real Homes">
                </a>

                <div class="tag-line">
                    <span>Tempat cari kontrakan asoy</span>
                </div>
            </div>


            <div class="menu-and-contact-wrap">

                <h2  class="contact-number"><i class="icon-phone"></i>0856-5993-2130 <span class="outer-strip"></span></h2>
                <!-- Start Main Menu-->
                <nav class="main-menu">
                    <div class="menu-main-menu-container">
                        <ul id="menu-main-menu" class="clearfix">
                            <li class="current-menu-item current_page_item"><a href="index.php">Home</a></li>
                            
                            <li><a href="index.php?page=contactform">Contact us</a></li>
                        </ul>


                    </div>
                </nav><!-- End Main Menu -->

            </div><!-- End .menu-and-contact-wrap -->

        </header>

    </div> <!-- End Header Container -->

</div><!-- End Header -->

<div id="home-flexslider" class="clearfix">
    
</div><!-- End Slider -->


    <div class="container contents">
        <div class="row">
            <div class="span12">
                <div class="main">

                <section class="advance-search ">
                    <div class="as-form-wrap">
                        <form class="advance-search-form clearfix" action="prosescari.php" method="post">

                            <table>
<tr><td width="30%">Jenisa Kontrakan</td><td width="40%">Propinsi</td><td>Fasilitas :</td><td></td><td></td></tr>
<tr><td><input type="radio" value="Rumah" name="jenis_search">Rumah</td><td><select name="propinsi_search" id="propinsi_search">
            <option value="0">Pilih Provinsi</option>
            <?php
            $query  = "SELECT propinsi_id,propinsi FROM propinsi ORDER BY Propinsi ASC";
            $result = mysql_query($query);
            $output = '';
            while($hasil = mysql_fetch_assoc($result))
            {
                $output .= "<option value='".$hasil['propinsi_id']."'>".$hasil['propinsi']."</option> \n";
            }
            echo $output;
            ?>
    
            </select></select></td><td><input type="checkbox" value="Internet" name="fasilitas1_search">Internet</td><td><input type="checkbox" value="Garasi" name="fasilitas3_search">Garasi </td><td></td></tr>
<tr><td><input type="radio" value="Kamar" name="jenis_search">Kamar</td><td>Kota</td><td><input type="checkbox" value="Tempat Tidur" name="fasilitas2_search">Tempat Tidur</td><td><input type="checkbox" value="AC" name="fasilitas4_search">Pendingin Ruangan</td><td></td></tr>
<tr><td></td><td><select name="kota_search" id="kota_search">
            <option>Pilih Provinsi Dulu</option>
        </select></td><td></td><td></td><td></td></tr>
</table>

                            <input type="submit" value="Search" class=" real-btn btn">
                        </form>
                    </div>
                </section><!-- End .advance-search -->


                <section class="property-items">

                    <center>
                    <?php


                        if(!isset($_GET['page']))
                        {
                            include "property-items.php";

                        }
                        else if($_GET["page"] == 'editprofile')
                        {
                            $email = $_SESSION['email'];
                            $query = mysql_query("SELECT * FROM anggota WHERE email = '$email'");
                            $hasil = mysql_fetch_array($query);
                            include "editprofile.php";
                        }
                        else if($_GET["page"] == 'daftar')
                        {
                            
                            include "daftar.php";
                        }
                        else if($_GET["page"] == 'iklansaya')
                        {
                            
                            include "iklansaya.php";
                        }
                        else if($_GET["page"] == 'pasangiklan')
                        {
                            
                            include "pasangiklan.php";
                        }
                        else if($_GET["page"] == 'cariiklan')
                        {
                            
                            include "cariiklan.php";
                        }
                         else if($_GET["page"] == 'contactform')
                        {
                            
                            include "contactform.php";
                        }
                        else if($_GET["page"] == 'detiliklan')
                        {
                            $_GET['id_iklan'];
                            $link_id_iklan = $_GET['id_iklan'];
                            include "detiliklan.php";
                        }
                        else if($_GET["page"] == 'hapus_iklan_saya')
                        {
                            $_GET['id_iklan'];
                            $link_id_iklan = $_GET['id_iklan'];
                            include "proses_hapus_iklan.php";
                        }
                         else if($_GET["page"] == 'editiklan')
                        {     
                            $_GET['id_iklan'];
                            $link_id_iklan = $_GET['id_iklan'];
                            $query1  = mysql_query ("SELECT * FROM Iklan WHERE id_iklan= '$link_id_iklan' ");
                            $hasil =  mysql_fetch_array($query1);
                            include "editiklan.php";
                        }
                        else
                        {
                            include "property-items.php";
                        }
                      
                    ?>   

                    </center>

                </section><!-- End .property-items -->             

                </div><!-- End .main -->
            </div><!-- End span12 -->
        </div><!-- End .row -->
    </div><!-- End .contents -->




<footer id="footer-wrapper">

    <div id="footer" class="container">

        <div class="row">



    </div>

    <!-- Footer Bottom -->
    <div id="footer-bottom" class="container" align="center">

        <div class="row">
            <div class="">
                <p class="copyright">© BaraKatakDeveloper 2013 All Rights Reserved.</p>
            </div>
            <div class="span6">
        </div>

    </div>
    <!-- End Footer Bottom -->
</center>
</footer>


                <script src="js/jquery.min.js"></script>
                <script src="js/flexslider/jquery.flexslider.js"></script>
                <script src="js/elastislide/jquery.easing.1.3.js"></script>
                <script src="js/elastislide/jquery.elastislide.js"></script>
                <script src="js/prettyphoto/jquery.prettyPhoto.js"></script>
                <script src="js/swipebox/jquery.swipebox.min.js"></script>
                <script src="js/jquery.isotope.min.js"></script>
                <script src="js/jquery.jcarousel.min.js"></script>
                <script src="js/jquery.validate.min.js"></script>
                <script src="js/jquery.form.js"></script>
                <script src="js/jquery.selectbox.js"></script>
                <script src="js/jquery.transit.min.js"></script>
                <script src="js/bootstrap.min.js"></script>
                <script src="js/jquery-twitterFetcher.js"></script>
                <script src="js/custom.js"></script>

        </body>
</html>


